import java.util.Random;
import java.util.Scanner;

//import java.util.Scanner;//导包
public class Test {
    public static void main(String[] args) {
        Random random = new Random();//定义一个变量random，其可随机生成一个数字(定义)
        int ranNum = random.nextInt(100);//定义一个变量ranNum接受随机生成的[1,100)（赋值）
        System.out.println("生成的随机数字："+ranNum);
        Scanner scanner = new Scanner(System.in);//定义一个变量scanner，让其接收从键盘输入的值（定义）
        while (true){
            System.out.println("请输入你要猜的数字");
            int num = scanner.nextInt();//用num接收输入的整数（赋值）
            if (num >ranNum){
                System.out.println("猜大了");
            }else if (num == ranNum){
                System.out.println("猜中了");
                break;
            }else{
                System.out.println("猜小了");
            }

        }
    }
    public static void main33(String[] args) {
        Scanner scanner = new Scanner(System.in);//定义一个变量名scanner，让其等于从键盘输入的值
        while (scanner.hasNextLine()){//当scanner有后续字符串
            String a = scanner.nextLine();//让a等于输入的字符串
            System.out.println(a);//打印a
        }
//        while (scanner.hasNextInt()){//当scanner有后续整数
//            int a = scanner.nextInt();//让a等于输入的整数
//            System.out.println(a);//打印a
//        }
    }
    public static void main12(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的年龄");
        int age = scanner.nextInt();
        System.out.println(age);

//        scanner.nextLine();

        System.out.println("请输入你的姓名");
        String name = scanner.nextLine();
        System.out.println(name);

        System.out.println("请输入你的工资");
        Float f = scanner.nextFloat();
        System.out.println(f);
//        int num = 10;
//        if(num % 2 == 0){
//            System.out.println("num是偶数");
//        }else{
//            System.out.println("num是奇数");
    }
}

//    public static void main2(String[] args) {
//        int n = 4;
//        if (n > 0){
//            System.out.println("n是正数");
//        }else if(n < 0){
//            System.out.println("n是复数");
//        }else{
//            System.out.println("n是0");
//        }
//    }
//
//    public static void main4(String[] args) {
//       // Scanner scanner = new Scanner(System.in);
//        Scanner scanner = new Scanner(System.in);
//        int a = scanner.nextInt();
//        if (a % 100 == 0) {
//            if (a % 400 == 0) {
//                System.out.println("a是世纪闰年");
//            } else {
//                System.out.println("a不是世纪闰年");
//            }
//        } else {
//            if (a % 4 == 0) {
//                System.out.println("a是普通闰年");
//            } else {
//                System.out.println("a不是普通闰年");
//            }
//        }
//    }
//
//    public static void main5(String[] args) {
//        int a = 10;
//        switch (a){
//            case 1:
//                System.out.println(1);
//                break;
//            case 2:
//                System.out.println(2);
//                break;
//            default:
//                System.out.println("输出有误！！！！");
//                break;
//        }
//    }
//
//    public static void main6(String[] args) {
//        //1~100的和
////        int a = 1;
////        int sum = 0;
////        while (a <= 100){
////            sum += a;
////            a++;
////        }
////        System.out.println(sum);
//        //1~100奇数的和
////        int a = 1;
////        int sumodd = 0;
////        while (a <= 100){
////            sumodd += a;
////            a += 2;
////        }
////        System.out.println(sumodd);
//        //1~100偶数的和
////        int a = 2;
////        int sumEdd = 0;
////        while (a <= 100){
////            sumEdd += a;
////            a += 2;
////        }
////        System.out.println(sumEdd);
//        //求5的阶乘
////        int a = 1;
////        int ret = 1;
////        while (a <= 5){
////            ret *=a;
////            a++;
////        }
////        System.out.println(ret);
//
//        //计算1~5的阶乘
////        int i = 1;
////        int sum = 0;
////        while (i <= 5){
////            int a = 1;
////            int ret = 1;
////            while (a <= i){
////                ret *= a;
////                a++;
////            }
////            sum += ret;
////            i++;
////        }
////        System.out.println(sum);
////        int a = 1;
////        while (a <= 100){
////            if (a % 3 == 0&&a % 5 == 0){
////                System.out.println(a);
////                break;
////            }
//        //continue循环找到3和5的100以内的倍数
////        int i = 1;
////        while (i <= 100){
////            if (i % 15 != 0){
////                i++;
////                continue;
////            }
////            System.out.println(i);
////            i++;
////        }
//
////        for (int i = 0; i < 10; i++) {
////            System.out.println(i);
//        //for循环实现阶乘和
////        int sum = 0;
////        for (int k = 0; k <= 6 ; k++) {
////            int ret = 1;
////            for (int i = 0; i <= k ; i++) {
////                ret *= i;
////
////            }
////            sum += ret;
////
////        }
////        System.out.println(sum);
//
////        int i = 1;
////        do {
////            System.out.println(i);
////            i++;
////        }while (i != 0);
//    }
//
